/**
 * @author Wang Hai Long  [whailong2010@gmail.com]
 * @date Sep 28, 2014 10:53:01 AM
 */
package com.surent.view.adapter;

import android.content.Context;
import android.graphics.Bitmap;

import com.hailong.surent.R;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
import com.surent.view.custom.BaseAdapterHelper;
import com.surent.view.custom.QuickAdapter;

/**
 * @author Wang Hai Long [whailong2010@gmail.com]
 * @date Sep 28, 2014 10:53:01 AM
 */
public class AdapterSelectedPic extends QuickAdapter<String> {
	private DisplayImageOptions options;

	public AdapterSelectedPic(Context context) {
		super(context, R.layout.item_selectedpic);

		options = new DisplayImageOptions.Builder().showImageOnLoading(R.drawable.ic_launcher)// 加载中显示的图片
				.showImageForEmptyUri(R.drawable.ic_launcher)// Uri为空或是错误的时候显示的图片
				.showImageOnFail(R.drawable.ic_launcher)// 图片加载/解码过程中错误时候显示的图片
				.cacheInMemory(true)// 是否允许入内容
				.cacheOnDisk(true)// 是否允许存入外存
				.considerExifParams(true).displayer(new RoundedBitmapDisplayer(3)).bitmapConfig(Bitmap.Config.RGB_565)// //设置图片的解码类型
				.build();
	}

	@Override
	protected void convert(BaseAdapterHelper helper, String path) {
		helper.setImageUrl(R.id.iv_item_selectedpic, path, options);
	}
}
